package httpproxy.controller;

import httpproxy.service.ProxyService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class ProxyController {
	@Autowired
	private ProxyService proxyService;

	@RequestMapping(value = "/**", method = RequestMethod.GET)
	public void getRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		proxyService.proxyGetRequest(request, response);
		return;
	}

	@RequestMapping(value = "/**", method = RequestMethod.POST)
	public void postRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		proxyService.proxyPostRequest(request, response);
		return;
	}
}
